#ifndef _H_MODBUS_HOST_
#define _H_MODBUS_HOST_

#include "control_command.h"
#include <RTL.h>
#include <stdint.h>

typedef enum {
		MODBUS_HOST1,
		MODBUS_HOST2,
		MODBUS_HOST4,
		MODBUS_HOST6,
		
        nlMODBUS_HOST		
}MBH_TYPE;

extern int32_t ModbusHost_Open(const MBH_TYPE mbhid);

extern void ModbusHost_Close(const MBH_TYPE mbhid);

extern int32_t ModbusHost_Write_Reg(const MBH_TYPE mbhid,const uint8_t slave,const uint16_t addr,const uint16_t value);

extern int32_t ModbusHost_Read_Regs(const MBH_TYPE mbhid,const uint8_t slave,const uint16_t addr,const uint16_t n,uint16_t *data);

extern int32_t ModbusHost_Write_Regs(const MBH_TYPE mbhid,const uint8_t slave,const uint16_t addr,const uint16_t n,uint16_t *data);

extern void ModbusHost_Control(const MBH_TYPE mbhid,const U32 command,const U32 parameter,void *prag);

extern int32_t ModbusHost_Write_Coil(const MBH_TYPE mbhid,const uint8_t slave,const uint16_t addr,const uint16_t n,uint8_t *data);

extern int32_t ModbusHost_Read_Coil(const MBH_TYPE mbhid,const uint8_t slave,const uint16_t addr,const uint16_t n,uint8_t *data);

#endif
